#!/bin/sh

echo "=========列出所有磁盘设备=============


Display Name:设备显示名称，
Size：设备容量(单位：MB),
Is USB:是否为USB设备"
echo " "
echo "⇓⇓⇓⇓⇓⇓⇓ "
esxcli storage core device list | grep -E 'Display Name:|Size:|Is USB:'   
echo " "
echo " "
echo " ==========检查每块硬盘的 SMART 状态==============

Health - 健康状态:  若OK,通过，   若IMPENDING FAILURE，则需要更新硬盘
Temperature - 温度
Reallocated - 重映射扇区计数(坏道指标)"
echo " "
echo "⇓⇓⇓⇓⇓⇓⇓ "
for disk in $(esxcli storage core device list | grep 'naa\|t10' | awk '{print $1}'); do
  echo "检查硬盘: $disk"
  esxcli storage core device smart get -d $disk | grep -E 'Health|Temperature|Reallocated'
  echo "==================================================="
done
